<%@ page language="java" contentType="text/html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Comparison Chart Page</title>
<link rel="stylesheet" href="../../css/styles.css" type="text/css" />
<script type="text/javascript" src="js/validation.js"></script>
</head>
<script type="text/javascript">
	  function showSearchForm(){
	      document.getElementById("viewDiv").style.display = "block";
	  }
	  function setDisplay(){
	     var getDetailsField = document.getElementById("getDetailsField");
	     if(getDetailsField != null){
	        showSearchForm();
	     }
	  }
	  function validateFormOnSearch(theForm){
		var reason = "";
		
		reason +=validateSelectProduct(theForm.qdItem);
		if (reason !=""){
		alert("Error Message:\n" + reason);
		return false;
		}
		return true;
	}
</script>
<body onload="javascript:setDisplay();">
	<div id="container">
		<jsp:include page="/jsp/menu.jsp" />
		<div style="height:420px;">
		 	<div class="path">
				<br><a href="home.htm"> Home </a>-&gt;
				<a> Account </a>-&gt;
				<a> Purchase </a>-&gt;
				<a href="comparisonChart.htm"> Comparison Chart </a>
		  	</div>
		  	<div id="leftDiv" style="margin-left: 10px;margin-top: 20px">
		   		<b>Comparison Chart Details</b><br><br>
				<fieldset style="height:50px; width:200px;background: #FFF;">
				<table cellpadding=20>
					<tr>
						<td>
							<a href="javascript:showSearchForm()">
		                        	View Comparison Chart
							</a>
						</td>
					</tr>
				</table>
				</fieldset>
		  	</div>
		  </div>
		  <form:form method="POST" action="getcomparisonChart.htm" commandName="comparisonChartDetails" onsubmit="return validateFormOnSearch(this)">
			  <div id="viewDiv" class="maininfo" style="display: none">
				  <div class="lable">
							Comparision Chart
				  </div>
				  <div id="searchForm">
					  <table>
							<tr>
								<th> Select Product </th>
								<td><b><form:select path="qdItem">
  									<form:option value="" label="--- Select ---"/>
	  									<c:forEach items="${model.pList}" var="product">
	  										<form:option value="${product.strProdTypeDesc}">${product.strProdTypeDesc}</form:option>
	  									</c:forEach>
	  								</form:select></b>
	  							</td>
							</tr>
							<tr>
								<th> </th>
								<td><input type="submit" value="Search" size=3 /></td>
							</tr>					
					 </table>
				 </div>
				 <c:if test="${!empty model.bList}">
				 <div id="viewTable" style="overflow: scroll; width:700px; height:125px">
					 <table cellpadding="10">
						 <tr>
							 <th>Vendor Name</th>
							 <th>Quotation No</th>
							 <th>Quantity</th>
							 <th>Rate Quoted</th>
							 <th>Discount Allowed</th>
							 <th>Taxes</th>
							 <th>Generate PO</th>
						 </tr>
					 	<c:forEach items="${model.bList}" var="quoteDetails">
						 <tr>
							 <td><c:out value="${quoteDetails.numVendorId}"></c:out></td>
							 <td><c:out value="${quoteDetails.strQuotationNo}"></c:out></td>
							 <td><c:out value="${quoteDetails.numQuantity}"></c:out></td>
							 <td><c:out value="${quoteDetails.strRate}"></c:out></td>
							 <td><c:out value="${quoteDetails.numDiscount}"></c:out></td>
							 <td><c:out value="${quoteDetails.numTax}"></c:out></td>
							 <td><form:radiobutton path="generate" value="null"/></td>
						 </tr>
						 </c:forEach>
					</table>
				 </div>
				 </c:if>
			 </div>
		 </form:form>
		 <c:if test="${model.isGet}">
	   		<input id="getDetailsField" type="hidden" name="getDetailsField"/>  
		 </c:if>
		 <div id="footer">
			<jsp:include page="/jsp/footer.jsp" />
		 </div>
	</div>
</body>
</html>
